﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin_ProductField.aspx.cs"
    Inherits="V5_EShop.Admin.Admin_ProductField" MasterPageFile="~/Admin/admin.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Header" runat="server">
    <script type="text/javascript">
        function addFileControl() {
            var str = "<br /><span>预设值：</span><span> <input name='txtFieldValue' type='text' style='width:50px;' /></span>" +
                    "<span style='width:20px;'></span>" +
                    "<span> 图片：</span><span> <input type='file' name='File' style='width:150px;' /></span>";
            $("#addfiles").after(str);
        }

        function onchoice(obj) {
            if (obj.id == 'chkIsUseImg') {
                if (!obj.checked) {
                    $("#plist1").css("display", "");
                    $("#plist2").css("display", "none");
                    $("#FileCollection").css("display", "none");
                } else {
                    $("#plist1").css("display", "none");
                    $("#plist2").css("display", "");
                    $("#FileCollection").css("display", "");
                }
            }
        }
        $(function () {
            if ($("#chkIsUseImg").attr("checked") == true) {
                $("#plist1").css("display", "none");
                $("#plist2").css("display", "");
                $("#FileCollection").css("display", "");
            }
        })
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Title" runat="server">
    产品扩展属性
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Nav" runat="server">
    <a href="Admin_ProductField.aspx?Action=edit&fclass=<%=FClassID%>">添加产品扩展属性</a>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Content" runat="server">
    <asp:MultiView ID="MultiViewList" runat="server">
        <asp:View ID="View1" runat="server">
            <asp:GridView ID="gvList" runat="server" GridLines="None" AutoGenerateColumns="False"
                OnRowCommand="gvList_RowCommand" CssClass="tablelist tableheader overlist">
                <HeaderStyle CssClass="headertext" />
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID">
                        <HeaderStyle CssClass="headertext" />
                        <ItemStyle HorizontalAlign="Center" Width="30px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="fieldName" HeaderText="字段名字">
                        <HeaderStyle CssClass="headertext" />
                    </asp:BoundField>
                    <asp:BoundField DataField="FieldValues" HeaderText="字段值">
                        <HeaderStyle CssClass="headertext" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%#Eval("ID")%>'
                                CommandName="go">修改</asp:LinkButton>
                            <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument='<%#Eval("ID")%>'
                                CommandName="del">删除</asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle CssClass="headertext" />
                        <ItemStyle HorizontalAlign="Center" Width="200px" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <webdiyer:AspNetPager ID="Pager" runat="server" CustomInfoHTML="共%PageCount%页，当前为第%CurrentPageIndex%页，每页%PageSize%条"
                FirstPageText="首页" HorizontalAlign="Right" LastPageText="尾页" NextPageText="下一页"
                OnPageChanged="Pager_PageChanged" PageIndexBoxType="DropDownList" PageSize="20"
                PrevPageText="上一页" ShowCustomInfoSection="Left" ShowPageIndexBox="Always" SubmitButtonText="Go"
                TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" AlwaysShow="True" Width="96%">
            </webdiyer:AspNetPager>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <table align="center" cellpadding="5" cellspacing="1" class="tablelist tableheader">
                <tr>
                    <td colspan="2">
                        <asp:Label ID="lblTitle" runat="server" Text="扩展预设值"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="width: 15%;">扩展属性名称：
                    </td>
                    <td>
                        <asp:TextBox ID="txtFieldName" runat="server" Width="236px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>用户是否选择：
                    </td>
                    <td>
                        <asp:CheckBox ID="chkChoice" runat="server" Text="是" />
                    </td>
                </tr>
                <tr>
                    <td>是否选用图片标识：
                    </td>
                    <td>
                        <asp:CheckBox ID="chkIsUseImg" runat="server" onclick="onchoice(this);" Text="是" />
                    </td>
                </tr>
                <tr>
                    <td>扩展属性预设值：
                    </td>
                    <td>
                        <p id="plist1">
                            <asp:TextBox ID="txtFieldValues" runat="server" Height="144px" TextMode="MultiLine"
                                Width="445px"></asp:TextBox>
                            如果只有一个值 显示的是文本,多个显示的是下拉列表.[多个<font face="宋体">用“,”隔开，如：诺基亚,西门子,索尼爱立信</font>]&nbsp;
                        </p>
                        <p id="plist2" style="display: none;">
                            <input id="btnAddFile" onclick="addFileControl()" type="button" value="增加预设值" />
                            <br />
                            <p id="FileCollection" style="display: none;">
                                <div id="addfiles">
                                    <span>预设值：</span> <span>
                                        <input name="txtFieldValue" style="width: 50px;" type="text" />
                                    </span><span style="width: 20px;"></span><span>图片：</span> <span>
                                        <input id="File" runat="server" name="File" style="width: 150px;" type="file" />
                                    </span>
                                </div>
                                <asp:DataGrid ID="dlAlreadyImgs" runat="server" AutoGenerateColumns="False" DataKeyField="id"
                                    HeaderStyle-CssClass="summary-title" OnDeleteCommand="dlAlreadyImgs_DeleteCommand"
                                    Width="35%">
                                    <Columns>
                                        <asp:TemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderText="预设值" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <%# DataBinder.Eval(Container.DataItem, "FieldValues")%>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="图片">
                                            <ItemTemplate>
                                                <a href='../uploadfiles/productFiled/<%# DataBinder.Eval(Container.DataItem, "FieldImgs")%>'
                                                    target="_blank">
                                                    <%# DataBinder.Eval(Container.DataItem, "FieldImgs")%>
                                                </a>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:ButtonColumn ButtonType="LinkButton" CommandName="Delete" HeaderText="删除" Text="删除"></asp:ButtonColumn>
                                    </Columns>
                                </asp:DataGrid>
                            </p>
                        </p>
                    </td>
                </tr>
                <tr>
                    <td>选择类型
                    </td>
                    <td>&nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <asp:HiddenField ID="hfID" runat="server" Value="0" />
                        <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Style="width: 78px"
                            Text="添加保存" />
                    </td>
                </tr>
            </table>
        </asp:View>
    </asp:MultiView>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Footer" runat="server">
</asp:Content>
